package cn.iocoder.yudao.module.system.controller.admin.mini.userInfo.vip;

import cn.iocoder.yudao.module.system.controller.admin.mini.orderInfo.order.controller.admin.order.vo.OrderExcelVO;
import cn.iocoder.yudao.module.system.controller.admin.mini.orderInfo.order.dal.dataobject.order.OrderDO;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;

import java.math.BigDecimal;

/**
 * 会员消费记录
 */
@Data
public class VipExcelVO {

    @ExcelProperty("订单号")
    private String orderCode;
    @ExcelProperty("推荐人名称")
    private String personName;
    @ExcelProperty("用户名称")
    private String userName;
    @ExcelProperty("订单状态")
    private String orderStatus;
    @ExcelProperty("支付状态")
    private String payStatus;
    @ExcelProperty("支付时间")
    private String payTime;
    @ExcelProperty("订单总价")
    private BigDecimal totalAmount;
    @ExcelProperty("商品总价")
    private BigDecimal goodsAmount;
    @ExcelProperty("折扣金额")
    private BigDecimal deduction;
    @ExcelProperty("付款金额")
    private BigDecimal payPrice;
    @ExcelProperty("运费")
    private BigDecimal freightPrice;
    @ExcelProperty("创建时间")
    private String createTime;


    public VipExcelVO() {
    }

    public VipExcelVO(OrderDO vo,String personName,String userName) {
        this.orderCode = vo.getOrderCode();
        this.personName = personName==null?"":personName;
        this.userName = userName==null?"":userName;
        String orderStatus = "";
        switch (vo.getOrderStatus()) {
            case 1:
                orderStatus = "代付款";
                break;
            case 2:
                orderStatus = "待发货";
                break;
            case 3:
                orderStatus = "待收货";
                break;
            case 4:
                orderStatus = "已完成";
                break;
            case 5:
                orderStatus = "退款售后";
                break;
            case 6:
                orderStatus = "已失效";
                break;
        }
        this.orderStatus = orderStatus;
        String payStatus = "未支付";
        if (vo.getPayStatus() == 1) {
            payStatus = "已支付";
        }
        this.payStatus = payStatus;
        this.payTime = OrderExcelVO.trunTime(vo.getPayTime());
        this.totalAmount = vo.getTotalAmount();
        this.goodsAmount = vo.getGoodsAmount();
        this.deduction = vo.getDeduction();
        this.payPrice = vo.getPayPrice();
        this.freightPrice = vo.getFreightPrice();
        this.createTime = OrderExcelVO.trunTime(vo.getCreateTime());
    }
}
